package com.zrrd.mcl.cart.client;

import com.zrrd.mcl.cart.client.impl.CartFeignClientImpl;
import com.zrrd.mcl.common.result.Result;
import com.zrrd.mcl.model.cart.CartInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

@FeignClient(value = "service-cart", fallback = CartFeignClientImpl.class)
public interface CartFeignClient {

    //添加购物车
    @PostMapping("/api/cart/addToCart/{skuId}/{skuNum}")
    Result addToCart(@PathVariable("skuId") Long skuId,
                     @PathVariable("skuNum") Integer skuNum);

    //获取选中的商品
    @GetMapping("/api/cart/getCartCheckedList/{userId}")
    List<CartInfo> getCartCheckedList(@PathVariable("userId") String userId);

    //更新购物车数据(更新最新价格)
    @GetMapping("/api/cart/loadCartData/{userId}")
    Result loadCartData(@PathVariable("userId") String userId);
}
